<template lang="html">
  <div class="img-upload">
    <van-tabbar v-model="active"  @change="onChange" :active-color="$store.state.oldPage?' #E63633':'#1989fa'">
    <van-tabbar-item v-for='(item,index) in navList' :key='index' :name='item.path'>
        <span>{{item.name}}</span>
        <template #icon="props">
            <img :src="!props.active ?item.icon:$store.state.oldPage? item.icon_active2 : item.icon_active" />
        </template>
    </van-tabbar-item>
 
    </van-tabbar>
  </div>
</template>
<script>
export default {
	data() {
		return {
			active: '',
			navList: [
				{
					name: '我的任务',
					icon: require('../../assets/images/new/wdrw1.png'),
					icon_active: require('../../assets/images/new/wdrw2.png'),
					icon_active2: require('../../assets/images/new/wdrw1.png'),
					path: '/home',
				},
				{
					name: '历史任务',
					icon: require('../../assets/images/new/sxbl1.png'),
					icon_active: require('../../assets/images/new/sxbl2.png'),
					icon_active2: require('../../assets/images/new/sxbl2.png'),
					path: '/precedure',
				},
				{
					name: '舆情管控',
					icon: require('../../assets/images/new/yqgk1.png'),
					icon_active: require('../../assets/images/new/yqgk2.png'),
					icon_active2: require('../../assets/images/new/yqgk2.png'),
					path: '/publicSentiment',
				},
				
			],
		};
	},
	created() {},
	mounted() {
		setTimeout(() => {
			// console.log(this.$route);
			this.active = this.$route.path;
		}, 500);
	},
	watch: {
		// $route(to, from) {
		//   console.log(to.path);
		// },
	},
	methods: {
		onChange(path) {
			// console.log(path);
			if (path == 'null') {
				this.$notify({ type: 'success', message: '开发中' });
			} else {
				this.$router.push(path);
			}
		},
	},
};
</script>
<style lang="less" scoped>
</style>